import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        IAbility animal = null;
        int type = input.nextInt();
        String name = input.next();
        int age = input.nextInt();
        if (type == 1)
            animal = new Dog(name, age);
        else
            animal = new Cat(name, age);

        Simulator sim = new Simulator();
        sim.playSound(animal);
        input.close();
    }
}


abstract class Animal {
    private String name;  //名字
    private int age;   //年龄

    public Animal(String name, int age) {
        this.name = name;
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }
}

interface IAbility {
    void showInfo();  //输出动物信息

    void cry();    //动物发出叫声
}

class Dog extends Animal implements IAbility {
    Dog(String name, int age) {
        super(name, age);
    }

    @Override
    public void showInfo() {
        System.out.printf("我是一只狗,我的名字是%s,今年%d岁\n"
                , this.getName(), this.getAge());
    }

    @Override
    public void cry() {
        System.out.println("旺旺");
    }
}

class Cat extends Animal implements IAbility {
    Cat(String name, int age) {
        super(name, age);
    }

    @Override
    public void showInfo() {
        System.out.printf("我是一只猫,我的名字是%s,今年%d岁\n"
                , this.getName(), this.getAge());
    }

    @Override
    public void cry() {
        System.out.println("喵喵");
    }
}

class Simulator implements IAbility {
    @Override
    public void showInfo() {}
    @Override
    public void cry() {}
    void playSound(IAbility animal) {
        animal.showInfo();
        animal.cry();

        Animal anm= (Animal) animal;
        System.out.println(anm.getName());
        System.out.println(anm.getAge());
    }
}
